package xyz.flowlight.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import xyz.flowlight.domain.entity.LikeRecord;

@Mapper
public interface LikeMapper extends BaseMapper<LikeRecord> {
    /**
     * 根据用户ID和商品ID查询点赞记录
     * (等效于原JPA的 @Query 查询)
     */
    @Select("SELECT * FROM like_record WHERE user_id = #{userId} AND product_id = #{productId}")
    LikeRecord findByUserAndProduct(@Param("userId") Integer userId,
                                    @Param("productId") Integer productId);
}
